/*
Copyright (c) 2017-2018 Origin Quantum Computing. All Right Reserved.
Licensed under the Apache License 2.0

config_schema.h

Author: LiYe
Created in 2018-11-29


*/
#ifndef CONFIG_SCHEMA_H
#define CONFIG_SCHEMA_H

const char kConfigSchema[] =
"{"
"    \"$schema\": \"http://json-schema.org/draft-04/schema#\","
"    \"title\": \"QPanda Algorithm Test Config Schema\","
"    \"description\": \"QPanda Algorithm Test Config Schema\","
"    \"definitions\": {"
"        \"algorithm\": {"
"            \"type\": \"object\","
"            \"properties\": {"
"                \"name\": {"
"                    \"type\": \"string\","
"                    \"enum\": ["
"                        \"QAOA\","
"                        \"VQE\""
"                    ]"
"                }"
"            },"
"            \"required\": [\"name\"],"
"            \"additionalProperties\": false"
"        },"
"        \"problem\": {"
"            \"anyOf\": ["
"                {"
"                    \"description\": \"QAOA Problem\","
"                    \"type\": \"array\","
"                    \"items\": {"
"                        \"type\": \"array\","
"                        \"minItems\" : 3,"
"                        \"maxItems\" : 3,"
"                        \"items\": ["
"                            {"
"                                \"type\": \"string\","
"                                \"pattern\": \"^[XYZ][0-9]+$\","
"                                \"minimum\": 0"
"                            },"
"                            {"
"                                \"type\": \"string\","
"                                \"pattern\": \"^[XYZ][0-9]+$\","
"                                \"minimum\": 0"
"                            },"
"                            {\"type\": \"number\"}"
"                        ]"
"                    }"
"                },"
"                {"
"                    \"description\": \"VQE Problem\","
"                    \"type\": \"array\","
"                    \"items\": {"
"                        \"type\": \"array\","
"                        \"minItems\" : 2,"
"                        \"items\": ["
"                            {"
"                                \"type\": \"string\","
"                                \"enum\": ["
"                                    \"H\",\"He\",\"Li\",\"Be\",\"B\",\"C\",\"N\","
"                                    \"O\",\"F\",\"Ne\",\"Na\",\"Mg\",\"Al\","
"                                    \"Si\",\"P\",\"S\",\"Cl\",\"Ar\""
"                                ]"
"                            },"
"                            {"
"                                \"type\": \"array\","
"                                \"minItems\": 3,"
"                                \"maxItems\": 3,"
"                                \"items\": ["
"                                    {\"type\": \"number\"}"
"                                ]"
"                            }"
"                        ]"
"                    },"
"                    \"additionalProperties\": false"
"                }"
"            ]"
"        },"
"        \"optimizer\": {"
"            \"type\": \"object\","
"            \"properties\": {"
"                \"name\": {"
"                    \"type\": \"string\","
"                    \"enum\": ["
"                        \"Nelder-Mead\","
"                        \"Powell\""
"                    ]"
"                },"
"                \"max_iter\": {"
"                    \"description\": \"maximum allowed number of iterations.\","
"                    \"type\": \"integer\","
"                    \"minimum\": 1"
"                },"
"                \"max_fcalls\": {"
"                    \"description\": \"maximum allowed number of function evaluations.\","
"                    \"type\": \"integer\","
"                    \"minimum\": 1"
"                },"
"                \"xatol\": {"
"                    \"description\": \"absolute error in xopt between iterations that is acceptable for convergence.\","
"                    \"type\": \"number\","
"                    \"default\": 1e-4"
"                },"
"                \"fatol\": {"
"                    \"description\": \"absolute error in func(xopt) between iterations that is acceptable for convergence.\","
"                    \"type\": \"number\","
"                    \"default\": 1e-4"
"                },"
"                \"disp\": {"
"                    \"description\": \"whether to print optimized log to the terminal.\","
"                    \"type\": \"boolean\""
"                },"
"                \"adaptive\": {"
"                    \"description\": \"para of Nelder-Mead. adapt algorithm parameters to dimensionality of problem. useful for high-dimensional minimization.\","
"                    \"type\": \"boolean\""
"                }"
"            },"
"            \"required\": [\"name\"],"
"            \"additionalProperties\": false"
"        },"
"        \"two_para\": {"
"            \"type\": \"object\","
"            \"properties\": {"
"                \"x_min\": {"
"                    \"type\": \"number\""
"                },"
"                \"x_max\": {"
"                    \"type\": \"number\""
"                },"
"                \"x_step\": {"
"                    \"type\": \"number\""
"                },"
"                \"y_min\": {"
"                    \"type\": \"number\""
"                },"
"                \"y_max\": {"
"                    \"type\": \"number\""
"                },"
"                \"y_step\": {"
"                    \"type\": \"number\""
"                }"
"            },"
"            \"required\": ["
"                \"x_min\","
"                \"x_max\","
"                \"x_step\","
"                \"y_min\","
"                \"y_max\","
"                \"y_step\""
"            ],"
"            \"additionalProperties\": false"
"        },"
"        \"two_para_pos\": {"
"            \"type\": \"array\","
"            \"minItems\": 2,"
"            \"maxItems\": 2,"
"            \"items\": {"
"                \"type\": \"integer\","
"                \"minimum\": 0"
"            }"
"        },"
"        \"initial\": {"
"            \"type\": \"object\","
"            \"properties\": {"
"                \"random\": {"
"                    \"type\": \"boolean\""
"                },"
"                \"value\": {"
"                    \"oneOf\": ["
"                        {"
"                            \"type\": \"array\","
"                            \"minItems\": 2,"
"                            \"items\": ["
"                                {\"type\": \"number\"}"
"                            ]"
"                        },"
"                        {"
"                            \"type\": \"object\","
"                            \"properties\": {"
"                                \"min\": {"
"                                    \"type\": \"number\""
"                                },"
"                                \"max\": {"
"                                    \"type\": \"number\""
"                                }"
"                            },"
"                            \"required\": [\"min\", \"max\"],"
"                            \"additionalProperties\": false"
"                        }"
"                    ]"
"                }"
"            },"
"            \"required\": [\"random\", \"value\"],"
"            \"additionalProperties\": false"
"        },"
"        \"2atom_pos\": {"
"            \"oneOf\": ["
"                {"
"                    \"description\": \"user defined data.\","
"                    \"type\": \"array\","
"                    \"minItems\": 1,"
"                    \"items\": ["
"                        {\"type\": \"number\"}"
"                    ]"
"                },"
"                {"
"                    \"description\": \"random data.\","
"                    \"type\": \"object\","
"                    \"properties\": {"
"                        \"begin\": {"
"                            \"type\": \"number\""
"                        },"
"                        \"end\": {"
"                            \"type\": \"number\""
"                        },"
"                        \"size\": {"
"                            \"type\": \"integer\","
"                            \"minimum\": 2"
"                        }"
"                    },"
"                    \"required\": [\"begin\", \"end\", \"size\"],"
"                    \"additionalProperties\": false"
"                }"
"            ]"
"        },"
"        \"parameters\": {"
"            \"anyOf\": ["
"                {"
"                    \"description\": \"QAOA\","
"                    \"type\": \"object\","
"                    \"properties\": {"
"                        \"step\": {"
"                            \"type\": \"integer\","
"                            \"minimum\": 1"
"                        },"
"                        \"shots\": {"
"                            \"type\": \"integer\","
"                            \"minimum\": 100"
"                        },"
"                        \"delta_t\": {"
"                            \"type\": \"number\""
"                        },"
"                        \"initial\": {"
"                            \"$ref\": \"#/definitions/initial\""
"                        },"
"                        \"test\": {"
"                            \"description\": \"user defined test\","
"                            \"type\": \"object\","
"                            \"properties\": {"
"                                \"name\": {"
"                                    \"type\": \"string\","
"                                    \"enum\": ["
"                                        \"ScanPara\""
"                                    ]"
"                                },"
"                                \"use_mpi\": {"
"                                    \"type\": \"boolean\""
"                                },"
"                                \"output_file\": {"
"                                    \"type\": \"string\""
"                                },"
"                                \"para\": {"
"                                    \"oneOf\": ["
"                                        {"
"                                            \"description\": \"ScanPara, if keys is not empty, it will get the probability\","
"                                            \"type\": \"object\","
"                                            \"properties\": {"
"                                                \"2p\": {"
"                                                    \"$ref\": \"#/definitions/two_para\""
"                                                },"
"                                                \"2pos\": {"
"                                                    \"description\": \"depens on the step.\","
"                                                    \"$ref\": \"#/definitions/two_para_pos\""
"                                                },"
"                                                \"keys\": {"
"                                                    \"description\": \"keys of the problem\","
"                                                    \"type\": \"array\","
"                                                    \"minItems\" : 1,"
"                                                    \"items\": {"
"                                                        \"type\": \"string\""
"                                                    }"
"                                                }"
"                                            },"
"                                            \"required\": [\"2p\", \"2pos\"],"
"                                            \"additionalProperties\": false"
"                                        }"
"                                    ]"
"                                }"
"                            },"
"                            \"required\": [\"name\", \"para\"],"
"                            \"additionalProperties\": false"
"                        }"
"                    },"
"                    \"required\": [\"step\"],"
"                    \"additionalProperties\": false"
"                },"
"                {"
"                    \"description\": \"VQE\","
"                    \"type\": \"object\","
"                    \"properties\": {"
"                        \"psi4_path\": {"
"                            \"description\": \"psi4 path\","
"                            \"type\": \"string\""
"                        },"
"                        \"shots\": {"
"                            \"type\": \"integer\","
"                            \"minimum\": 100"
"                        },"
"                        \"use_mpi\": {"
"                            \"type\": \"boolean\""
"                        },"
"                        \"save_optimizer_data\": {"
"                            \"type\": \"boolean\""
"                        },"
"                        \"data_save_path\": {"
"                            \"type\": \"string\""
"                        },"
"                        \"basis\":{"
"                            \"type\": \"string\""
"                        },"
"                        \"multiplicity\":{"
"                            \"type\": \"integer\""
"                        },"
"                        \"charge\":{"
"                            \"type\": \"integer\""
"                        },"
"                        \"atoms_pos\": {"
"                            \"oneOf\":["
"                                {"
"                                    \"$ref\": \"#/definitions/2atom_pos\""
"                                },"
"                                {"
"                                    \"description\": \"three or more atoms distance\","
"                                    \"type\": \"array\","
"                                    \"items\": {"
"                                        \"type\": \"array\","
"                                        \"items\": {"
"                                            \"type\": \"array\","
"                                            \"minItems\" : 3,"
"                                            \"items\": ["
"                                                {\"type\": \"number\"}"
"                                            ]"
"                                        }"
"                                    }"
"                                }"
"                            ]"
"                        }"
"                    },"
"                    \"required\": [\"psi4_path\", \"basis\", \"multiplicity\", \"charge\", \"atoms_pos\"],"
"                    \"additionalProperties\": false"
"                }"
"            ]"
"        }"
"    },"
"    \"type\": \"object\","
"    \"properties\": {"
"        \"algorithm\":        { \"$ref\": \"#/definitions/algorithm\" },"
"        \"problem\":          { \"$ref\": \"#/definitions/problem\" },"
"        \"optimizer\":        { \"$ref\": \"#/definitions/optimizer\" },"
"        \"parameters\":       { \"$ref\": \"#/definitions/parameters\"}"
"    },"
"    \"required\": [\"algorithm\", \"problem\", \"parameters\"],"
"    \"additionalProperties\": false"
"}";


#endif // CONFIG_SCHEMA_H
